﻿@model PH.Model.Accounts.UserModel

<div class="GeneralEdit" id="fmEmail">
    <ul>
         <li>
            <label for="txtEmail">班级序号：</label>
            <input type="email" class="k-textbox" id="txtEmail" name="email" value="@Model.Email" required validationMessage="请输入Email地址" />
            <span class="k-invalid-msg" data-for="email"></span>
        </li>
        <li class="editButtons">
            <button id="btnSave" class="k-button"><span class="k-icon k-i-tick"></span><span>确认提交</span></button>
            &nbsp;&nbsp;
            <button class="k-button" onclick="CancelGeneralEdit();"><span class="k-icon k-i-cancel"></span><span>&nbsp;返&nbsp;回</span></button>
        </li>
    </ul>
</div>

<script class="save">
    $(function () {
        var validator = $("#fmEmail").kendoValidator().data("kendoValidator");
        $("#btnSave").click(function (e) {
            if (validator.validate()) {
                var values = {
                    guid: "@Model.Guid",
                    email:$("#txtEmail").val()

                };
                Whale.Remote.Operation({
                    url: "/Accounts/User/ChangeEmail",
                    parameters: values,
                    success: function (result) {
                        wndGeneralEdit.close();
                        if ($("#grid_school").length > 0)
                            $("#grid_school").data("kendoGrid").dataSource.read();
                        if ($("#grid_bureau").length > 0)
                            $("#grid_bureau").data("kendoGrid").dataSource.read();
                    },
                    error: function (msg) {
                        wndGeneralInformation.content(msg).open();
                    }
                });
            }
            return false;
        });
    });
</script>
